package sg.edu.nus.iss.billing.gui.component;

import javax.swing.JOptionPane;

import sg.edu.nus.iss.billing.exception.ControllerException;
import sg.edu.nus.iss.billing.exception.ValidationException;

public class ErrorDialog {
	public static void showValidationErrorMessageDialog(ValidationException e){
		String title="Error";
		JOptionPane.showMessageDialog(null, e.getMessage(), title, JOptionPane.ERROR_MESSAGE);
	}
	public static void showControllerErrorMessageDialog(ControllerException e){
		String title="Error:[" + e.getErrorCode() + "]";
		String errorMessage="[" + e.getErrorCode() + "]: " + e.getMessage();  
		JOptionPane.showMessageDialog(null, errorMessage, title, JOptionPane.ERROR_MESSAGE);
	}
	public static void showUnhandledErrorMessageDialog(Exception e){
		String title="Unknown Error";
		JOptionPane.showMessageDialog(null, e.getMessage(), title, JOptionPane.ERROR_MESSAGE);
	}
	public static void showMessageDialog(String message){
		String title="Message";
		JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
	}
}
